package com.example.demo.common;

import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author: cheng
 * @date: 2023/6/28 19:03
 * @description: 统一异常处理
 */
@RestControllerAdvice
public class MyExceptionAdvice {
    @ExceptionHandler(Exception.class)
    public AjaxResult doException(Exception e){
        return AjaxResult.fail(-1,e.getMessage());
    }
}
